<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>企业简介</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/style_zj.css">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../fonts/iconfont.css">
</head>
<body>
<!--<div id="header_01_html">
    <iframe id="header_01" src="head_01.html" frameborder="0"></iframe>
</div>-->
<div class="content-box">
    <!--<div id="left_tab_html">
        <iframe id="left_tab" src="left_tab.html?x=4&y=2" frameborder="0"></iframe>
    </div>-->
    <div class="right-box layui-form">
        <div class="friend-tips">
            <div class="title-box"><i class="icon-sty"></i><b class="title-tip">温馨提示</b></div>
            <div class="info-list">1、在这里可以修改我的头像信息</div>
            <div class="info-list">2、图片尺寸调整为160*160像素，将会达到最佳效果 </div>
        </div>
        <div class="content-admin">

            <div class="title-toggle">
                <div class="item active">设置我的头像</div>
            </div>
            <div>
                <div class="input-box1">
                    <div class="li clearfix">
                        <!--<div class="left-k"><span class="col-ff4"></span><span class="text-sty1"></span></div>-->
                        <div class="file-img">
                            <div class="box-file">
                                <img src="../img/file1.png" alt="" class="upload_btn">
                            </div>
                        </div>
                    </div>
                    <div class="">
                        <span class="release-btn1 js-submitBtn">保存</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--<div>
    <iframe src="footer-record.html" style="width: 100%;border: none;height:60px;"></iframe>
</div>-->
<script src="../js/config.js"></script>
<script>
    get_ajax("/web/auth/info",{},function (data) {
        console.log(data.headPortraits);
        if(data.picUrl){
            $('.upload_btn').attr('src',imgBaseUrl+data.picUrl)
        }
    })
    var picUrl = '';
    //图片上传
    layui.use(['upload'], function () {
        var $ = layui.jquery, upload = layui.upload;
        //普通图片上传
        var uploadInst = upload.render({
            elem: '.upload_btn'
            ,multiple:true
            , url: baseUrl + '/file/upload?token=' + Token
            , before: function (obj) {
                loading = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
            }
            , done: function (res, index) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg.msg('上传失败');
                } else {
                    var data = res.data;
                    picUrl = data.address
                    $('.upload_btn').attr('src',imgBaseUrl+picUrl)
                    layer.close(loading);
                    console.log('上传成功！')
                }

            }
            , error: function () {

            }
        });
    })
    $(document).on('click','.js-submitBtn',function(){   //提交
        get_ajax("/web/auth/updataInfo",{picUrl:picUrl},function (data) {
            layer.msg('头像更新成功！')
        })
        $('.upload_btn').attr('src',imgBaseUrl+picUrl)
    })
</script>
</body>
</html>